$(function () {
    $('#personal-center-aside .aside-list .publish').addClass('active');

    var id = utils.getQueryVariable('id');
    $.ajax({
        url: ports.getContributeDetail,
        data:{
            id:id
        },
        success: function (res) {
            console.log('获取稿件详情', res);
            if (res.status == 200) {
                var resData = res.data;
                $('.item.contribution-title .value').html(resData.title||'默认标题');
                $('.item.publish-type .value').html(resData.contributePublishType.publishTypeName);
                $('.item.explain .value').html(resData.note||'');
                $('.item.related-link .value').html(resData.relativeUrl||'');
                $('.item.channel .value').html(resData.contributeChannel.channelName||'');
                $('.item.date .value').html(resData.prepublishDate?resData.prepublishDate.substr(0,10):'');
                $('.item.type .value').html(resData.contributeType.typeName);
                $('.item.name .value').html(resData.contributor||'');
                $('.item.phone .value').html(resData.tel);
                $('.item.company .value').html(resData.company||'');
                $('.item.email .value').html(resData.email||'');
                $('.item.address .value').html(resData.contact||'');
                $('.item.postcode .value').html(resData.postcode||'');

                $.each(resData.attachmentList,function (i,item) {
                    $('ul.files-list').append(
                        '<li>\n' +
                        '    <i class="iconfont icon-fujian2"></i>\n' +
                        '    <span class="file-name" title='+ item.fileName +'>' + item.fileName + '</span>\n' +
                        '    <span class="size">（'+ item.fileSize/1000 +'KB）</span>'+
                        '</li>'
                    )
                })
            }

        }
    })
})